package com.calligraphy.product.model;

import lombok.Data;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;

/**
 * @Author hy
 * @Date 2019/1/10 14:36
 **/
@Data
@Entity
@Table(name = "ProductSecKill")
public class ProductSecKill {

    @Id
    private String id;

    /** 商品编号. */
    private String productId;

    /** 秒杀数量. */
    private String stockCount;

    /** 开始时间. */
    private Date startDate;

    /** 结束时间. */
    private Date endDate;

    private Date createTime;

    private Date updateTime;

    @PrePersist
    public void onPersist() {
        createTime = new Timestamp(System.currentTimeMillis());
    }

    @PreUpdate
    public void onUpdate() {
        updateTime = new Timestamp(System.currentTimeMillis());
    }
}
